
//鼠标事件
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;

import javax.swing.*;

import static java.lang.Thread.sleep;

public class Test04 {
    public static void main(String[] args) throws InterruptedException {
        WebDriver webDriver=new ChromeDriver();
        webDriver.get("https://www.baidu.com/");
        Actions actions=new Actions(webDriver);
        sleep(3000);
        WebElement target=webDriver.findElement(By.cssSelector("#s-top-left > a:nth-child(6)"));
        sleep(1000);
        actions.moveToElement(target).contextClick().perform();

    }
}
